package fields;

import game.Player;

public class Ships extends Ownable {

	private final int RENT_1, RENT_2, RENT_3, RENT_4;
	
	public Ships(int number, String name, int price) { //Konstruktør	
	super(number, name, price);
	RENT_1 = 500;
	RENT_2 = 1000;
	RENT_3 = 2000;
	RENT_4 = 4000;
	}
	
	public void landOnField(Player sp)
	{
		if (!isOwnable() && sp!=owner && !owner.isInJail() && !isPawned())
		{
			sp.transfer(getRent(), owner);
		}
		else if (isOwnable()) {
			if (sp.getChoice()) {
				buy(sp);
				sp.setChoice(false);
			}
		}
	}
	
	public int getRent()
	{
		int rent=0;
		switch (owner.numberOfShips()) {
		case 1: rent=RENT_1;
		break;
		case 2: rent=RENT_2;
		break;
		case 3: rent=RENT_3;
		break;
		case 4: rent=RENT_4;
		break;
		}
		return rent;
	}
	
}